﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.SqlClient;
using System.Data.Common;

public partial class DatabaseVerificationAdmin : System.Web.UI.Page
{
    Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase("Application_Data");

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = db.ExecuteDataSet(CommandType.Text, @"SELECT LOWER(PrimaryContactEmail) AS PrimaryContactEmail,Count(DatabaseName) AS DatabaseCount FROM [Database] WHERE DatabaseNAme NOT IN ('master', 'model','msdb','tempdb') GROUP BY PrimaryContactEMail Order By PrimaryContactEmail");

            this.gv.DataSource = ds;
            this.gv.DataBind();
        }        
    }
}
